home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-05 | 1.9 KB | 87 lines | [TEXT/MSET] |
- \ WordBatch - read text from a batch of Microsoft Word documents.
- \ Revised May 87 for compatibility with Neon 2.0 and new MW docs code.
-
- need MWdocs
-
- int VOL#
- file+ WDFILE
- string+ FNAMES
-
- forward MYST \ Executed when MYSTERY? is set true. The appl can't
- \ check properly because it doesn't know when we
- \ switch to a new input file.
-
- :f MYST ;f \ Default: do nothing
-
- :class WORDBATCH super( object )
-
- \ int VOL#
-
- :m NEXT?: \ ( -- f )
- nextline?: fnames drop len: fnames 0>
- dup ( save in stk for return )
- IF
- clear: wdfile get: fnames name: wdfile
- get: vol# setVRef: wdfile
- open: wdfile OK? print: wdfile cr
- wdfile bring: theDoc
- close: wdfile drop
- true fixup: theDoc drop
- mystery? IF myst THEN
- begin: text
- THEN ;m
-
- :m OPEN: \ ( -- f )
- true -> text_only?
- pushnew: loadfile
- 'type TEXT 1 stdget: topfile
- NIF drop: loadfile false EXIT THEN
- cls open: topfile OK?
- topfile $ 16 + w@ put: vol#
- new: fnames
- new: text new: fmt_run new: para_run new: style_names
- readtop: fnames 0 >lim: fnames
- next?: self ;m
-
- :m CLOSE:
- close: wdfile drop release: fnames
- release: text release: fmt_run release: para_run
- release: style_names ;m
-
-
- \ GETLINE: is designed to work in the same way as in class File+,
- \ so that the caller doesn't have to worry about whether his input is coming
- \ from a single file or a batch of files.
- \ It reads the next line into the given string and returns TRUE, or, if end
- \ file has been reached, sets the length of the string to zero and returns
- \ FALSE.
-
- :m GETLINE?: { str -- b }
- nextline?: text ?dup
- NIF next?: self line>: text THEN
- text ->: str ;m
-
- :m GETALL: { str -- }
- clear: str
- BEGIN
- reset: text text addstr: str
- next?: self
- NUNTIL
- reset: str close: self ;m
-
- ;class
-
- wordbatch BATCH
-
- EndLoad
-
- \ testing
-
- \ string+ S
- \ : TEST
- \ new: s open: batch 0EXIT
- \ ( s getall: batch ) ;
-
- \ : ZZ
- \ release: s release: text ;
-